Skip to content

Gitleaks: allowlist synthetic secret fixtures, guard the allowlist - #2338

Merged
remigiusz-antczak merged 2 commits into
mainfrom
fix/gitleaks-fixture-allowlist-2
Nov 13, 2026
Merged

remigiusz-antczak merged 2 commits into
mainfrom
fix/gitleaks-fixture-allowlist-2

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Supersedes #2337 and addresses its independent review.

A gitleaks scan of the last 200 commits reported 91 hits. Every hit is a synthetic credential that was planted on purpose in a secret-detector test fixture. That noise is why gitleaks can't yet be a required check.

.gitleaks.toml (new, at the repo root)

  • Extends the default rules.
  • Allowlists only these fixture files, each by an anchored path regex:
    • secret-leaks.txt, secret-decoys.txt and ledger.jsonl in each docs/bench/secrets-heldout*/ directory;
    • docs/bench/g1-matrix/heldout/*/result.json;
    • two secret test scripts.
  • Every other file in those directories is still scanned, including each README, RESULTS.md, score.py and SHA256-frozen.txt.

scripts/test_gitleaks_allowlist.sh (new, registered via scripts/ci-tests.d)

  • Plants a fake AWS key outside the allowlist. The key is assembled at runtime, so no literal is committed.
  • Requires exit code 1 and an aws-access-token RuleID in a fresh JSON report. This is checked with the repo config and, as a control, with the default config. A stale report is removed before each run, so an invalid config can't pass.
  • Requires at least 12 heldout directories, uses a quoted array, and checks that each allowlisted path exists and scans clean.
  • Skips when gitleaks is absent.

Verification

  • An invalid TOML config fails the test, as it should.
  • The history scan now finds 0 hits, down from 91.
  • Local scripts/test-ci-gates.sh: 303 pass, 8 fail, 2 skipped. The 8 failures are the known sandbox baseline.

🤖 Generated with Claude Code

A root .gitleaks.toml extends the default rules and allowlists only the
synthetic secret-detector fixture files by anchored path regex (the
secret-leaks, secret-decoys and ledger files, the g1-matrix heldout
result files and two secret test scripts), taking the history scan from
91 hits to 0. Sibling files in those dirs stay scanned.

scripts/test_gitleaks_allowlist.sh requires an aws-access-token finding
for a fake key outside the allowlist, with the repo config and with the
default config as a control, and a clean scan of the fixture paths. It
skips when gitleaks is absent.

Tests: 303/311 (sandbox baseline unchanged; new guard passes)
No-Mechanism-Reason: config and test only, no skill prose changed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@remigiusz-antczak
remigiusz-antczak merged commit ea73f66 into main Nov 13, 2026
11 of 12 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the fix/gitleaks-fixture-allowlist-2 branch November 13, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant